import App, { Container } from "next/app";
import MainLayout from "../components/layout";

export default class Hello extends React.Component {
    static async getInitialProps(ctx) {
        // const res = await fetch('https://api.github.com/repos/vercel/next.js')
        // const json = await res.json()
        const userAgent = ctx.req ? ctx.req.headers['user-agent'] : navigator.userAgent
        return { stars: 5, userAgent }
      }
      render() {
          return (<MainLayout>
              Hello, {this.props.stars}
          <div>{this.props.userAgent}</div>
          </MainLayout>)
      }
}